package org.fastsyncer.common.entity;

import java.io.Serializable;
import java.util.Date;

import org.fastsyncer.common.constant.CommonConstant;
import org.fastsyncer.common.constant.MappingConstant;
import org.fastsyncer.common.util.ApplicationUtil;

/**
 * 默认的驱动配置
 * 
 * @ClassName: Task
 * @Description: 包含基本的映射名称、同步状态（全量、增量）、线程数、同步时间等
 * @author: YangPei
 * @date: 2017年7月12日 下午1:57:43
 */
public class Task implements Serializable {

	private static final long serialVersionUID = 323413001570641034L;
	
	// 映射名称
	private String name;
	
	// 是否启用该任务
	private boolean enable = true;
	
	// 同步状态（全量、增量）
	private String model = MappingConstant.SYNC_ALL;
	
	// 每次执行任务总数
	private Integer maxTask = Integer.parseInt(ApplicationUtil.getKey(CommonConstant.WORKER_TASK_MAX_NUMBER));
	
	// 每次批量执行数
	private Integer batchNum = Integer.parseInt(ApplicationUtil.getKey(CommonConstant.WORKER_BATCH_NUMBER));
	
	// 线程数
	private Integer threadNum = Integer.parseInt(ApplicationUtil.getKey(CommonConstant.WORKER_THREAD_NUMBER));
	
	// 总进度
	private Integer process = 0;
	
	// 已完成进度
	private Integer processCompleted = 0;
	
	// 成功
	private Integer success = 0;
	
	// 失败
	private Integer fail = 0;
	
	// 错误
	private Integer error = 0;
	
	// 同步时间（单位毫秒）
	private Long runTime;
	
	// 最近运行时间
	private Date startDate = new Date();
	
	// 最近运行时间字符串
	private String startDateStr;
	
	// 是否在运行
	private boolean isRun = false;

	public Task() {
		super();
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	public boolean isEnable() {
		return enable;
	}

	public void setEnable(boolean enable) {
		this.enable = enable;
	}

	public Integer getBatchNum() {
		return batchNum;
	}

	public void setBatchNum(Integer batchNum) {
		this.batchNum = batchNum;
	}

	public Integer getThreadNum() {
		return threadNum;
	}

	public void setThreadNum(Integer threadNum) {
		this.threadNum = threadNum;
	}

	public Integer getMaxTask() {
		return maxTask;
	}

	public void setMaxTask(Integer maxTask) {
		this.maxTask = maxTask;
	}

	public Integer getProcess() {
		return process;
	}

	public void setProcess(Integer process) {
		this.process = process;
	}

	public Integer getProcessCompleted() {
		return processCompleted;
	}

	public void setProcessCompleted(Integer processCompleted) {
		this.processCompleted = processCompleted;
	}

	public Integer getSuccess() {
		return success;
	}

	public void setSuccess(Integer success) {
		this.success = success;
	}

	public Integer getFail() {
		return fail;
	}

	public void setFail(Integer fail) {
		this.fail = fail;
	}

	public Integer getError() {
		return error;
	}

	public void setError(Integer error) {
		this.error = error;
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public String getStartDateStr() {
		return startDateStr;
	}

	public void setStartDateStr(String startDateStr) {
		this.startDateStr = startDateStr;
	}

	public Long getRunTime() {
		return runTime;
	}

	public void setRunTime(Long runTime) {
		this.runTime = runTime;
	}

	public boolean isRun() {
		return isRun;
	}

	public void setRun(boolean isRun) {
		this.isRun = isRun;
	}

}
